<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<x:parse xml="${param.xmlstr}" var="xmlData" />
<c:set var="grant_code"><x:out select="$xmlData/data/proposal/grant_code" /></c:set>
<c:set var="sub_grant_code"><x:out select="$xmlData/data/proposal/sub_grant_code" /></c:set>

<div class="t_bar"><span class="color_red">*</span>申请贷款付息情况（万元）</div>
<table class="table01 t_css" width="100%" border="0" cellpadding="0" id="fin1"
	cellspacing="1">
	<tr>
	    <td width="200" align="left">贷款银行</td>
		<td colspan="2">
			<input  name="loan/bank" label="贷款银行" type="text" 
					class="input_text required"  style="maxlength="50" 
					value="<x:out select="$xmlData/data/loan/bank" />" />
		</td>
		<td width="200" align="left">企业在贷款银行开户账号</td>
		<td colspan="2">
			<input  name="loan/bank_account" label="企业在贷款银行开户账号" type="text" 
					class="input_text required"  maxlength="50" 
					value="<x:out select="$xmlData/data/loan/bank_account" />" />
		</td>
		
	</tr>
	<tr>
	    <td width="200" align="left">授信合同编号</td>
		<td colspan="2">
			<input  name="loan/contract_no" label="授信合同编号" type="text" 
					class="input_text required"  maxlength="50" 
					value="<x:out select="$xmlData/data/loan/contract_no" />" />
		</td>
		<td width="200" align="left">授信额度</td>
		<td colspan="2">
			<input  name="loan/credit" label="授信额度" type="text" 
					class="input_text required"  maxlength="50" 
					value="<x:out select="$xmlData/data/loan/credit" />" />
		</td>
	</tr>
	<tr>
	    <td width="200" align="left">授信期限</td>
		<td colspan="5">
			<input  name="loan/credit_period" label="授信期限" type="text" 
					class="input_text required"   maxlength="50" 
					value="<x:out select="$xmlData/data/loan/credit_period" />" />
		</td>
	</tr>
</table>
<table class="table01" width="100%" border="0" cellpadding="0"
	id="tblloans" cellspacing="1">
    <thead>
		<tr>
			<th class="TblHead" align="center" width="7%">选择</th>
			<th class="TblHead" align="center" width="7%">序号</th>
			<th class="TblHead" align="center" width="11%">贷款合同/借据编号 </th>
			<th class="TblHead" align="center" width="11%">贷款金额 </th>
			<th class="TblHead" align="center" width="11%">贷款期限 </th>
			<th class="TblHead" align="center" width="11%">年利率 </th>
			<th class="TblHead" align="center" width="11%">计息方式 </th>
			<th class="TblHead" align="center" width="11%">利息总额 </th>
			<th class="TblHead" align="center" width="11%">已付利息 </th>
		</tr>
			</thead>
			<tbody id="tab">
					<tr style="display:none">
						<td style="text-align:center;">&nbsp;
							<input type="radio" class="radiobutton" name="selloans" >
						</td>
						<td style="text-align:center;">&nbsp;
							<span name="loans|loan[0]@seq_no" >[index]</span> 
						</td>
						<td style="text-align:center;">
							<input type="text" size="10" name="loans|loan[0]|loan_contract" class="required input_text " 
							style="text-align:left;width:80px"  
							maxlength=50 label="贷款合同/借据编号" value="" />&nbsp;
						</td>
						<td style="text-align:center;">
							<input type="text" size="10" name="loans|loan[0]|money" class="required input_text " 
							style="text-align:right;width:80px" onchange="countTable('tblloans','loan_total','3')"
							maxlength=50 label="贷款金额" value="" onfocus="InitInput.setNumber(this,7,4,2)"/>&nbsp;
						</td>
						<td style="text-align:center;">
							<input type="text" size="10" name="loans|loan[0]|date" class="required input_text " 
							style="text-align:left;width:80px"  
							maxlength=50 label="贷款期限" value=""/>&nbsp;
						</td>
						<td style="text-align:center;">
							<input type="text" size="10" name="loans|loan[0]|per_annum" class="required input_text " 
							style="text-align:right;width:80px"  onfocus="InitInput.setNumber(this,3,2,2)"
							maxlength=50 label="年利率" value=""/>&nbsp;
						</td>
						<td style="text-align:center;">
							<input type="text" size="10" name="loans|loan[0]|type" class="required input_text " 
							style="text-align:left;width:80px" 
							maxlength=50 label="计息方式" value=""/>&nbsp;
						</td>
						<td style="text-align:center;">
							<input type="text" size="10" name="loans|loan[0]|total" class="required input_text " 
							style="text-align:right;width:80px" onfocus="InitInput.setNumber(this,7,4,2)"
							maxlength=50 label="利息总额" value=""/>&nbsp;
						</td>
						<td style="text-align:center;">
							<input type="text" size="10" name="loans|loan[0]|interest" class="required input_text " 
							style="text-align:right;width:80px" onfocus="InitInput.setNumber(this,7,4,2)"
							onchange="countTable('tblloans','interest_total','8')"
							maxlength=50 label="已付利息" value=""/>&nbsp;
						</td>
					</tr>
					<c:set value="0" var="index" scope="page"/>
					<x:forEach select="$xmlData/data/loans/loan" var="loans">
					<c:choose>
						<c:when test="${index<10}" >
						<c:set value="0" var="flag" scope="page"/>
						</c:when>
						<c:otherwise>
						<c:set value="" var="flag" scope="page"/>
						</c:otherwise>
					</c:choose>
					<tr>
						<td style="text-align:center;">&nbsp;
							<input type="radio" class="radiobutton" name="selloans" >
						</td>
						<td style="text-align:center;">
							<span name="loans/loan[${flag}${index}]@seq_no" >${index+1}</span> 
						</td>
						<td style="text-align:center;">
							<input type="text" size="10" name="loans/loan[${flag}${index}]/loan_contract" class="input_text required" 
							style="text-align:left;width:80px"  
							label="贷款合同/借据编号" value="<x:out select="$loans/loan_contract" />" />&nbsp;
						</td>
						<td style="text-align:center;">
							<input type="text" size="10" name="loans/loan[${flag}${index}]/money" class="input_text required" 
							style="text-align:right;width:80px"  onfocus="InitInput.setNumber(this,7,4,2)"
							onchange="countTable('tblloans','loan_total','3')"
							label="贷款金额" value="<x:out select="$loans/money" />" />&nbsp;
						</td>
						<td style="text-align:center;">
							<input type="text" size="10" name="loans/loan[${flag}${index}]/date" class="input_text required" 
							style="text-align:left;width:80px" 
							label="贷款期限" value="<x:out select="$loans/date" />" />&nbsp;
						</td>
						<td style="text-align:center;">
							<input type="text" size="10" name="loans/loan[${flag}${index}]/per_annum" class="input_text required" 
							style="text-align:right;width:80px" onfocus="InitInput.setNumber(this,3,2,2)"
							label="年利率" value="<x:out select="$loans/per_annum" />" />&nbsp;
						</td>
					    <td style="text-align:center;">
							<input type="text" size="10" name="loans/loan[${flag}${index}]/type" class="input_text required" 
							style="text-align:left;width:80px" 
							label="计息方式" value="<x:out select="$loans/type" />" />&nbsp;
						</td>
						<td style="text-align:center;">
							<input type="text" size="10" name="loans/loan[${flag}${index}]/total" class="input_text required" 
							style="text-align:right;width:80px" onfocus="InitInput.setNumber(this,7,4,2)"
							label="利息总额" value="<x:out select="$loans/total" />" />&nbsp;
						</td>
						<td style="text-align:center;">
							<input type="text" size="10" name="loans/loan[${flag}${index}]/interest" class="input_text required" 
							style="text-align:right;width:80px" onfocus="InitInput.setNumber(this,7,4,2)"
							onchange="countTable('tblloans','interest_total','8')"
							label="已付利息" value="<x:out select="$loans/interest" />" />&nbsp;
						</td>
					</tr>
					<c:set value="${index+1}" var="index" scope="page"/>
					</x:forEach>
				</tbody>
			</table>
			<table class="t_css" cellpadding="0" cellspacing="0" width="100%" align="center">
                <tr>
		            <td colspan="1"  class="thclass" nowrap style="text-align:left;" width="10%">实际已付利息总额：</td>
		            <td colspan="1" class="thclass" width="90%">
			           <input id="interest_total" name="loansamt/interest_total" label="实际已付利息总额" type="text" disabled
					     class="input_text gray valueEqual:interest_total:payment_total"  style="text-align:right" size="35" onfocus="InitInput.setNumber(this,7,4,2)"
					     value="<x:out select="$xmlData/data/loansamt/interest_total" />" /> （由系统自动合计列表中“已付利息”列）
		            </td>
		          
               </tr>						
            </table>
            <table class="t_css" cellpadding="0" cellspacing="0" width="100%" align="center">
                <tr>
		            <td colspan="1"  class="thclass" nowrap style="text-align:right;" width="10%">申请贷款贴息金额：</td>
		            <td colspan="1" class="thclass" width="90%" >
			           <input id="loan_total" name="loansamt/loan_total" label="申请贷款贴息金额"
			              type="text" disabled
					     class="input_text gray"  style="text-align:right" size="35" onfocus="InitInput.setNumber(this,7,4,2)"
					     value="<x:out select="$xmlData/data/loansamt/loan_total" />" /> （由系统自动合计列表中“贷款金额”列）
		          </td>
		          
               </tr>						
            </table>
			<br>
			<table width="98%" align="center">
				<tr>
					<td>
					<input class="button" name="cmdAddbefore" type=button value="添加" onclick="if(checkTabLimit('tblloans',10,'只能填写10个贷款付息情况')){addNewRow('tblloans');}try{top.resizeFrame();}catch(e){};">
					<input class="button" name="cmdMovePrev" type=button value="上移" onclick="movePrev('tblloans','selloans')">
					<input class="button" name="cmdMoveNext" type=button value="下移" onclick="moveNext('tblloans','selloans')">
					<input class="button" name="cmddel" type=button  value="删除" onclick="deleteSelectedRow('tblloans','贷款付息情况');countTable('tblloans','loan_total','3');countTable('tblloans','interest_total','8')">
					</td>
				</tr>
	        </table>
	        
<br>	        
<div class="t_bar"><span class="color_red">*</span>贷款付息明细</div>
<table class="table01" width="100%" border="0" cellpadding="0"
	id="tblloandetails" cellspacing="1">
    <thead>
		<tr>
			<th class="TblHead" align="center" width="10%">选择</th>
			<th class="TblHead" align="center" width="10%">序号</th>
			<th class="TblHead" align="center" width="30%">付息日期 </th>
			<th class="TblHead" align="center" width="30%">付息凭证号码 </th>
			<th class="TblHead" align="center" width="20%">付息金额（万元） </th>
		</tr>
			</thead>
			<tbody id="tab">
					<tr style="display:none">
						<td style="text-align:center;">&nbsp;
							<input type="radio" class="radiobutton" name="selloandetail" >
						</td>
						<td style="text-align:center;">&nbsp;
							<span name="loandetails|loandetail[0]@seq_no" >[index]</span> 
						</td>
						
                        <td style="text-align:center;">
				            <input  id="payment_date_[0]" name="loandetails|loandetail[0]|payment_date" value=""
				            class=" required input_text date" style="width:40%" 
				            label="付息日期" />
				        </td>						
						<td style="text-align:center;">
				            <input name="loandetails|loandetail[0]|payment_no" value=""
				            class=" required input_text" style="text-align:left;width:60%" 
				            label="付息凭证号码" />
				        </td>
				        <td style="text-align:center;">
				            <input name="loandetails|loandetail[0]|payment_money" value=""
				            class=" required input_text" style="text-align:right;width:60%" value="" onfocus="InitInput.setNumber(this,7,4,2)"
				            	onchange="countTable('tblloandetails','payment_total','4')"
				            label="付息金额" />
				        </td>
					</tr>
					<c:set value="0" var="index" scope="page"/>
					<x:forEach select="$xmlData/data/loandetails/loandetail" var="loandetails">
					<c:choose>
						<c:when test="${index<10}" >
						<c:set value="0" var="flag" scope="page"/>
						</c:when>
						<c:otherwise>
						<c:set value="" var="flag" scope="page"/>
						</c:otherwise>
					</c:choose>
					<tr>
						<td style="text-align:center;">&nbsp;
							<input type="radio" class="radiobutton" name="selloandetail" >
						</td>
						<td style="text-align:center;">
							<span name="loandetails/loandetail[${flag}${index}]@seq_no" >${index+1}</span> 
						</td>
						
						<td nowrap="nowrap" style="text-align:center;">
					        <c:set var="payment_date" scope="page"><x:out select="$loandetails/payment_date"/></c:set>
						    <input  id="payment_date_[${flag}${index}]" value="${payment_date}" label="付息日期" 
						    name="loandetails/loandetail[${flag}${index}]/payment_date" 
						    class="input_text required date"  style="width:40%"   /> 
					    </td>
					    <td style="text-align:center;">
							<input type="text"  name="loandetails/loandetail[${flag}${index}]/payment_no" 
							class="input_text required" maxlength=50 label="付息凭证号码"  size="35"
							style="text-align:left;width:100px" 
							value=<x:out select="$loandetails/payment_no" /> />&nbsp;
						</td>
						
						<td style="text-align:center;">
							<input type="text"  name="loandetails/loandetail[${flag}${index}]/payment_money" 
							class="input_text required" maxlength=50 label="付息金额"  size="35"
							style="text-align:right;width:100px" 
							onfocus="InitInput.setNumber(this,7,4,2)"
							onchange="countTable('tblloandetails','payment_total','4')"
							value=<x:out select="$loandetails/payment_money" /> />&nbsp;
						</td>
					</tr>
					<c:set value="${index+1}" var="index" scope="page"/>
					</x:forEach>
					<script type="text/javascript">
				    showAllDateTag("tblloandetails");
			        </script>
				</tbody>
			</table>
			<br>
			<table class="t_css" cellpadding="0" cellspacing="0" width="100%" align="center" style="display:none">
                <tr>
		            <td colspan="1"  class="thclass" nowrap style="text-align:right;" >付息金额总额：</td>
		            <td colspan="1" class="thclass" width="550px" >
			           <input id="payment_total" name="loandetailsamt/payment_total" label="贷款付息明细中付息金额总和"
			              type="text" disabled
					     class="input_text gray"  style="text-align:right" size="35" onfocus="InitInput.setNumber(this,7,4,2)"
					     value="<x:out select="$xmlData/data/oandetailsamt/payment_total" />" />
		          </td>
		          
               </tr>						
            </table>
	        <table width="98%" align="center">
				<tr>
					<td>
					<input class="button" name="cmdAddbefore" type=button value="添加" onclick="if(checkTabLimit('tblloandetails',10,'只能填写10个贷款付息明细')){addNewRow('tblloandetails');showDateTag('tblloandetails');}try{top.resizeFrame();}catch(e){};">
					<input class="button" name="cmdMovePrev" type=button value="上移" onclick="movePrev('tblloandetails','selloandetail')">
					<input class="button" name="cmdMoveNext" type=button value="下移" onclick="moveNext('tblloandetails','selloandetail')">
					<input class="button" name="cmddel" type=button  value="删除" onclick="deleteSelectedRow('tblloandetails','贷款付息明细');countTable('tblloandetails','payment_total','4')">
					</td>
				</tr>
	        </table>
	        